import request from '@/utils/request'

// 查询患者信息列表
export function listPatient(query) {
  return request({
    url: '/trms/patient/list',
    method: 'get',
    params: query
  })
}

// 查询区域信息列表
export function listArea(query) {
  return request({
    url: '/trms/patient/listArea',
    method: 'get',
    params: query
  })
}

// 查询患者信息详细
export function getPatient(patientId) {
  return request({
    url: '/trms/patient/' + patientId,
    method: 'get'
  })
}

// 新增患者信息
export function addPatient(data) {
  return request({
    url: '/trms/patient',
    method: 'post',
    data: data
  })
}

// 修改患者信息
export function updatePatient(data) {
  return request({
    url: '/trms/patient',
    method: 'put',
    data: data
  })
}

// 删除患者信息
export function delPatient(patientId) {
  return request({
    url: '/trms/patient/' + patientId,
    method: 'delete'
  })
}

// 修改第1次评估（2周期后）
export function updateD1cpg(data) {
  return request({
    url: '/trms/d1cpg',
    method: 'put',
    data: data
  })
}

// 修改第2次评估（4周期后）
export function updateD2cpg(data) {
  return request({
    url: '/trms/d2cpg',
    method: 'put',
    data: data
  })
}

// 修改第3次评估（6周期后）
export function updateD3cpg(data) {
  return request({
    url: '/trms/d3cpg',
    method: 'put',
    data: data
  })
}

// 修改第4次评估（手术前）
export function updateD4cpg(data) {
  return request({
    url: '/trms/d4cpg',
    method: 'put',
    data: data
  })
}

// 修改乳腺癌临床特征
export function updateRxalctz(data) {
  return request({
    url: '/trms/rxalctz',
    method: 'put',
    data: data
  })
}

// 修改首次辅助检查
export function updateScfzjc(data) {
  return request({
    url: '/trms/scfzjc',
    method: 'put',
    data: data
  })
}

// 修改随访信息
export function updateSfxx(data) {
  return request({
    url: '/trms/sfxx',
    method: 'put',
    data: data
  })
}

// 新增随访信息
export function addSfxx(data) {
  return request({
    url: '/trms/sfxx',
    method: 'post',
    data: data
  })
}

// 删除随访信息
export function delSfxx(id) {
  return request({
    url: '/trms/sfxx/'+id,
    method: 'delete'
  })
}

// 修改术后治疗情况
export function updateShzlqk(data) {
  return request({
    url: '/trms/shzlqk',
    method: 'put',
    data: data
  })
}

// 修改手术
export function updateSs(data) {
  return request({
    url: '/trms/ss',
    method: 'put',
    data: data
  })
}

// 修改术后病理
export function updateSsbl(data) {
  return request({
    url: '/trms/ssbl',
    method: 'put',
    data: data
  })
}

// 修改治疗前病理信息
export function updateZlqblxx(data) {
  return request({
    url: '/trms/zlqblxx',
    method: 'put',
    data: data
  })
}

// 新辅助治疗新增
export function addXfzzl(data) {
  return request({
    url: '/trms/pg',
    method: 'post',
    data: data
  })
}

// 新辅助治疗修改
export function updateXfzzl(data) {
  return request({
    url: '/trms/pg',
    method: 'put',
    data: data
  })
}

// 删除辅助化疗信息
export function delXfzhl(id) {
  return request({
    url: '/trms/pg/'+id,
    method: 'delete'
  })
}

// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
  return request({
    url: '/system/dict/data/type/' + dictType,
    method: 'get'
  })
}

// 查询要件列表
export function addYwyj(data) {
  return request({
    url: '/trms/patient/addYwyj',
    method: 'post',
    data: data
  })
}

// 查询患者信息是否存在
export function sfcz(query) {
  return request({
    url: '/trms/patient/sfcz',
    method: 'get',
    params: query
  })
}

/**
 * 是否可以编辑
 * @param {Object} that
 */
export function sfkybjData(that){
	if(that.userId == null || that.userId == undefined || that.userId == ''){
		that.isDisabled = false;
		return;
	}
	if(that.$store.state.user.userId == 1 || that.userId == that.$store.state.user.userId){
		that.isDisabled = false;
		return;
	}
	let roles = that.$store.state.user.roles;
	if(roles && roles.length > 0){
		for(let i in roles){
			if(roles[i] == 'editUser'){
				that.isDisabled = false;
				return;
			}
		}
	}
	that.isDisabled = true;
}